var app = getApp()
function requestStorys(page, callback) {
  let param = { "startPage": page, "userId": app.globalData.userId, "type": 1 }

  getApp().func.Post(false, getApp().api.user_fav_story, param,
    function (data) {
      typeof callback == "function" && callback(data)
    },
    function (error) {
      wx.showToast({
        title: error.data.message,
        icon: 'none',
        duration: 2000,
      })
    }
  )
};

function requestProducts(page, callback) {
  let param = { "startPage": page, "userId": app.globalData.userId, "type": 0 }

  getApp().func.Post(false, getApp().api.user_fav_goods, param,
    function (data) {
      typeof callback == "function" && callback(data)
    },
    function (error) {
      wx.showToast({
        title: error.data.message,
        icon: 'none',
        duration: 2000,
      })
    }
  )
};

module.exports = {
  requestStorys: requestStorys,
  requestProducts: requestProducts
};